<script setup lang='ts'>
import {nextTick, reactive, ref} from 'vue';
import {systemApi} from '@/api/controller';
import {ToastSuccess, Toastloading} from '@/utils/public';

const form = reactive({
  gameRules: '',
});

const upd = async () => {
  const loading = Toastloading();
  const gameRules = form.gameRules;
  await systemApi.updateGameRules({type:'bl', gameRules}).then(() => {
    ToastSuccess('编辑成功');
  }).catch(() => {
    loading.close();
  });
  loading.close();
};
const get = async () => {
  const loading = Toastloading();
  await systemApi.getGameRules({type: 'bl'}).then((res:any) => {
    form.gameRules=JSON.parse(res.data).rule;
  }).catch(() => {
    loading.close();
  });
  loading.close();
};
get();

</script>

<template>
  <div style="padding: 3em;">
    <el-form ref="dataForm" :model="form">
      <el-form-item label="倍率游戏规则">
        <el-input rows="30" type="textarea" v-model="form.gameRules" placeholder="请输入游戏规则"></el-input>
        <el-button style="margin-top: 2em;" type="primary" @click="upd">更新</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>
